package com.interview.javabase.algorithm;

import org.junit.Test;
import org.springframework.boot.test.context.SpringBootTest;

import java.time.LocalTime;

/**
 * @description:
 * @author: zhangshuguang@vichain.com
 * @date: 2019/06/12 15:19
 */
@SpringBootTest
public class Demo10 {

    @Test
    public void solution1() {
        Integer[][] arr = new Integer[][]{{1, 4, 7, 11, 15}, {2, 5, 8, 12, 19}, {3, 6, 9, 16, 22}, {10, 13, 14, 17, 24}, {18, 21, 23, 26, 30}};

        int tem = 20;
        for (int i = 0; i < arr.length; i++) {

            if (arr[i][0] > tem || arr[i][arr[i].length - 1] < tem) {
                break;
            }

            for (int i1 = 0; i1 < arr[i].length; i1++) {
                if ( arr[i][i1] == tem ){
                    System.out.println( arr[i][i1]);
                    break;
                }
            }

        }

    }
}
